package apiday01homework;

public class StringDemo {
    public static void main(String[] args) {
        String s1 = "hello";
        String s2 = "helloworld";

        if (s1 == s2) {
            System.out.println("s1 == s2");
        } else {
            System.out.println("s1 != s2");
        }
        if (s1.equals(s2)) {
            System.out.println("s1 equals s2");
        } else {
            System.out.println("s1 not equals s2");
        }
        if (s1.equals("hello")) {
            System.out.println("s1 equals hello");
        } else {
            System.out.println("s1 not equals hello");
        }
        String s3 = new String("hello");
        if (s1 == s3) {
            System.out.println("s1 == s3");
        } else {
            System.out.println("s1 != s3");
        }
        s1+="world";
        System.out.println(s1.equals(s2));
        String s4 = "hello" + "world";
        System.out.println(s1 == s4);
        String s5="hello";
        String s6=s5+"world";
        System.out.println(s1==s6);
        System.out.println(s1.equals(s6));

        String s7 = "hello";
        String s8 = new String("hello");
        System.out.println(s7 == s8);
        System.out.println(s7.equals(s8));
    }
}
